package com.example.baseapp.admin.serialize;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * BooleanSerialize class
 *
 * @author zhangl
 * @date 2022/5/2 15:08
 */
public class BooleanSerialize extends JsonSerializer<Boolean> {
    @Override
    public void serialize(Boolean boolValue, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeObject(boolValue ? 1 : 0);
    }
}
